<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
</html>
<script>
	//for循环，还有一个小应用，叫做累加器。
	//比如，我们现在想计算1+2+3+4+……100   100累加 = 1 + 2 + 3....+100=?
	
	//前提先定义一变量
	var sum = 0;
	//1 2 3 4 5
	//sum += 1;//1
	//sum += 2;//3
	//sum += 3;//6
	//sum += 4;//10 
	//sum += 5;//15......
	//用到循环
	for(var a = 1; a <= 100; a++){
		//1 2 3 4 5.......100
		sum += a;
	};

	console.log(sum);
</script>
